<html>
<head>
<title>CQ/XML - Defect Elements</title>
<link rel='stylesheet' type='text/css' href='cqxmldocs.css'/>
</head>

<body>
<center>
  <h1>ClearQuest/XML Interface User Guide</h1>
</center>

<h2>Defect Elements</h2>
<p>
Defect elements allow you to view, update and submit defect records in ClearQuest.  The defect element has one required and two optional attributes.
<center>
  <table cellspacing='0' cellpadding='2' width='80%' border='1'>
  <tr>
    <th>Required&nbsp;Attribute</th>
    <th>Description</th>
    <th>Notes</th>
  </tr>
  <tr>
    <td>id</td>
    <td>the unique key of the defect</td>
    <td>on a '<span class='inline'>submit</span>' action, use an id of '<span class='inline'>0</span>'</td>
  </tr>
  <tr>
    <th>Optional&nbsp;Attribute</th>
    <th>Description</th>
    <th>Notes</th>
  </tr>
  <tr>
    <td>action</td>
    <td>the action to perform on the defect</td>
    <td>
      <li>valid values: '<span class='inline'>view</span>' plus all actions permitted by ClearQuest except '<span class='inline'>un/duplicate</span>'</li>
      <li>if the attribute is omitted, '<span class='inline'>view</span>' is assumed, but will generate an error if no <i>value</i> is specified (ie: <span class='inline'>action=""</span>)</li>
    </td>
  </tr>
  <tr>
    <td>wait</td>
    <td>Should the action be performed now or queued up for later?</td>
    <td>
      <li>valid values: yes, no</li>
      <li>if the attribute is omitted, '<span class='inline'>no</span>' is assumed, but will generate an error if no <i>value</i> is specified (ie: <span class='inline'>wait=""</span>)</li>
    </td>
  </tr>
</table>
</center>
</p>

<h2>Defect Element Examples</h2>
<p>
<table cellspacing='0' cellpadding='2' border='0'>
<tr>
  <td class='data'><b>View</b> defect output to log:</td>
  <td class='data src'>
    &lt;<span class="elem">defect</span> <span class="atrb">id</span>=<span class="atrbval">'pract00301000'</span>&gt;
  </td>
</tr>
<tr>
  <td class='data'>Same as previous example:</td>
  <td class='data src'>
    &lt;<span class="elem">defect</span> <span class="atrb">id</span>=<span class="atrbval">'pract00301000'</span> <span class="atrb">action</span>=<span class="atrbval">'view'</span> <span class="atrb">wait</span>=<span class="atrbval">'no'</span>&gt;
  </td>
</tr>
<tr>
  <td class='data'>View defect, but wait for output:</td>
  <td class='data src'>
    &lt;<span class="elem">defect</span> <span class="atrb">id</span>=<span class="atrbval">'pract00301000'</span> <span class="atrb">action</span>=<span class="atrbval">'view'</span> <span class="atrb">wait</span>=<span class="atrbval">'yes'</span>&gt;
  </td>
</tr>
<tr>
  <td class='data'><b>Modify</b> a defect, wait for output:</td>
  <td class='data src'>
    &lt;<span class="elem">defect</span> <span class="atrb">id</span>=<span class="atrbval">'pract00301000'</span> <span class="atrb">action</span>=<span class="atrbval">'modify'</span> <span class="atrb">wait</span>=<span class="atrbval">'yes'</span>&gt;
  </td>
</tr>
<tr>
  <td class='data'><b>Assign</b> a defect, wait for output:</td>
  <td class='data src'>
    &lt;<span class="elem">defect</span> <span class="atrb">id</span>=<span class="atrbval">'pract00301000'</span> <span class="atrb">action</span>=<span class="atrbval">'assign'</span> <span class="atrb">wait</span>=<span class="atrbval">'yes'</span>&gt;
  </td>
</tr>
<tr>
  <td class='data'><b>Submit</b> a defect, output to log:</td>
  <td class='data src'>
    &lt;<span class="elem">defect</span> <span class="atrb">id</span>=<span class="atrbval">'0'</span> <span class="atrb">action</span>=<span class="atrbval">'submit'</span> <span class="atrb">wait</span>=<span class="atrbval">'no'</span>&gt;
  </td>
</tr>
<!-- 
&lt;<span class="elem">defect</span> <span class="atrb">id</span>=<span class="atrbval">'pract00301000'</span> <span class="atrb">action</span>=<span class="atrbval">'modify'</span> <span class="atrb">wait</span>=<span class="atrbval">'yes'</span>&gt;
-->
</table>
</p>

<h2>Putting It Together</h2>
<p>
Using the information from the <a href='rootelem.html'>ClearQuest Root Element</a> chapter, logging-in and viewing a defect would look like this:
</p>
<p>
<span class='src'>
&nbsp;&nbsp;
  &lt;<span class="elem">ClearQuest</span> <span class="atrb">login</span>=<span class="atrbval">'cq_user'</span> <span class="atrb">password</span>=<span class="atrbval">'password'</span> <span class="atrb">db</span>=<span class="atrbval">'pract'</span> <span class="atrb">repo</span>=<span class="atrbval">'practice'</span> <span class="atrb">email-fail</span>=<span class="atrbval">'cq_user@domain.com'</span>&gt;
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;
    &lt;<span class="elem">defect</span> <span class="atrb">id</span>=<span class="atrbval">'pract00301000'</span> <span class="atrb">action</span>=<span class="atrbval">'view'</span> <span class="atrb">wait</span>=<span class="atrbval">'no'</span>/&gt;
  <br>
&nbsp;&nbsp;
  &lt;/<span class="elem">ClearQuest</span>&gt;
</span>
</p>

<h2>Caveats</h2>
<p>
<ul>
  <li>You can't create DEIs from SRs via the CQ/XML Interface.</li>
  <li>You can't link a DEI to a SR via the CQ/XML Interface.</li>
</ul>
</p>

<h2>Up Next</h2>
<p>
Now that you can login and work with specific defects, the next chapter
<a href='field.html'>Field Elements</a> will show how to work with individual fields.
</p>

<!-- footer -->
<table class='ftr'>
<tr>
  <td class='ftrl'><a href='rootelem.html' class='ftr'><img src='arrow-l.gif'/> ClearQuest Root Element</a></td>
  <td class='ftrc'><a href='index.html' class='ftr'><img src='arrow-u.gif'/> Table of Contents</a></td>
  <td class='ftrr'><a href='field.html' class='ftr'>Field Elements <img src='arrow-r.gif'/></a></td>
</tr>
</table>
</body>
</html>
